extends "../cex___toolman/cex___toolman.gd"
func _info():
	pass

func _connect():
	._connect()

func _extInit():
	._extInit()
	chaName = "闪电图腾"
	lv = 2
	attCoe.atkRan = 4
	attCoe.atk = 0
	attCoe.maxHp = 150 / 112.5 / 2
	aiOn = false
	addSkillTxt("[color=red]无法移动，无法攻击[/color]\n每2秒对攻击范围内随机一个敌方造成200点真伤，并弹跳到随机敌方身上，伤害量为上一次的50%，弹跳2次")

var cnt = 0
func _upS():
	cnt += 1
	if cnt == 2:
		cnt = 0
		var chas = getAllChas(1)
		var waitrnd = []
		for i in chas:
			if inrange(i.cell,cell,att.atkRan):
				waitrnd.append(i)
		if !waitrnd.size():return
		var ncha = sys.rndListItem(waitrnd)
		ncha.addBuff(BF.new(1,200,3))

func inrange(a,b,c):
	var x = abs(a.x - b.x)
	var y = abs(a.y - b.y)
	return x*x + y*y <= c*c
	
class BF:
	extends Buff
	var healval
	var cnt
	func _init(lv,healval,cnt):
		attInit()
		self.healval = healval
		self.cnt = cnt
	func _connect():
		._connect()
		var chas = masCha.getAllChas(2)
		masCha.hurtChara(masCha,healval,Chara.HurtType.REAL,Chara.AtkType.SKILL)
		cnt -= 1
		healval *= 0.5
		if cnt:
			if chas.size() >=2:
				var ncha = sys.rndListItem(chas)
				while(ncha == masCha || ncha == null):
					ncha = sys.rndListItem(chas)
				if ncha:
					ncha.addBuff(self)
		isDel = true